#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

//连续和 O(NlogN)算法
int main() {
    ll n = 2000000;
    for (int p = 1; p < n; p++) { //n log n
        ll left = p + 1;
        ll right = n - 1;
        while (left <= right) {
            ll q = (left + right) / 2;
            ll s = (p + q) * (q - p + 1) / 2;
            if (s == n) {
                cout << p << " " << q << endl;
                break;
            } else if (s > n) {
                right = q - 1;

            } else {
                left = q + 1;
            }
        }
    }
    return 0;
}
